package com.CusterRelSys.service.impl;

import com.CusterRelSys.entity.SysPrivilege;
import com.CusterRelSys.entity.SysUser;
import com.CusterRelSys.mapper.SysUserMapperCBH;
import com.CusterRelSys.service.SysUserServiceCBH;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class SysUserServiceImplCBH implements SysUserServiceCBH {
    @Resource
    private SysUserMapperCBH sysUserMapperCBH;

    @Override
    public SysUser checkLogin(String username, String password) {
        //根据用户名实例化用户对象
        SysUser user = sysUserMapperCBH.selectSysUser(username);
        if (user != null && user.getUsrPassword().equals(password)) {
            return user;
        }
        return null;
    }

    @Override
    public List<SysPrivilege> selectuserPriviege(int uid) {
        return sysUserMapperCBH.selectuserPriviege(uid);
    }
}